﻿namespace Cos.Core.NHibernate.Util
{
    using Cos.Core.Model.Common;

    /// <summary>
    /// The Shared module that converts objects.
    /// </summary>
    public static class SharedConverter
    {
        /// <summary>
        /// Converts a CultureDataModel To Culture object.
        /// </summary>
        /// <param name="cultureDataModel">The CultureDataModel object.</param>
        /// <returns>The converted Culture object.</returns>
        public static Culture ToModel(this CultureDataModel cultureDataModel)
        {
            return new Culture
                 {
                     CultureCode = cultureDataModel.Id,
                     CultureDesc = cultureDataModel.CultureDesc,
                     IsDefaultCulture = cultureDataModel.IsDefault
                 };
        }

        /// <summary>
        /// Converts a Culture To  CultureDataModel object.
        /// </summary>
        /// <param name="culture">The culture object.</param>
        /// <returns>The converted CultureDataModel object.</returns>
        public static CultureDataModel ToDataModel(this Culture culture)
        {
            return new CultureDataModel { CultureDesc = culture.CultureDesc, Id = culture.CultureCode, IsDefault = culture.IsDefaultCulture };
        }
    }
}
